package operation;

import book.Book;
import book.Booklist;

import java.util.Scanner;

public class Find implements Canoperation {
    public void work(Booklist booklist) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入您要查询的书名：");
        String name = sc.nextLine();
        int sum = booklist.getBooksum();
        for (int i = 0; i < sum; i++) {
            Book book = booklist.getbook(i);
            if(book.getName().equals(name)){
                System.out.println(book);
                return;
            }
        }
        System.out.println("抱歉，图书馆无此书，可以联系管理员添加");
    }
}
